import json
from django.http import HttpResponse
from utils.jwt import DateEncoder

class Response(HttpResponse):

	def __init__(self, data=None, msg='操作成功', code=200, *args, **kwargs):
		_data = {
			"code": code,
			"data": data,
			"msg": msg,
			"flag": True
		}
		data = json.dumps(_data, cls=DateEncoder)
		super().__init__(data, *args, **kwargs)
